const Sequelize = require('sequelize');
module.exports = function(sequelize, DataTypes) {
  return sequelize.define('act_dmn_hi_decision_execution', {
    id: {
      type: DataTypes.STRING(255),
      allowNull: false,
      primaryKey: true,
      field: 'ID_'
    },
    decisionDefinitionId: {
      type: DataTypes.STRING(255),
      allowNull: true,
      field: 'DECISION_DEFINITION_ID_'
    },
    deploymentId: {
      type: DataTypes.STRING(255),
      allowNull: true,
      field: 'DEPLOYMENT_ID_'
    },
    startTime: {
      type: DataTypes.DATE(3),
      allowNull: true,
      field: 'START_TIME_'
    },
    endTime: {
      type: DataTypes.DATE(3),
      allowNull: true,
      field: 'END_TIME_'
    },
    instanceId: {
      type: DataTypes.STRING(255),
      allowNull: true,
      field: 'INSTANCE_ID_'
    },
    executionId: {
      type: DataTypes.STRING(255),
      allowNull: true,
      field: 'EXECUTION_ID_'
    },
    activityId: {
      type: DataTypes.STRING(255),
      allowNull: true,
      field: 'ACTIVITY_ID_'
    },
    failed: {
      type: DataTypes.BOOLEAN,
      allowNull: true,
      defaultValue: false,
      field: 'FAILED_'
    },
    tenantId: {
      type: DataTypes.STRING(255),
      allowNull: true,
      field: 'TENANT_ID_'
    },
    executionJson: {
      type: DataTypes.TEXT,
      allowNull: true,
      field: 'EXECUTION_JSON_'
    },
    scopeType: {
      type: DataTypes.STRING(255),
      allowNull: true,
      field: 'SCOPE_TYPE_'
    }
  }, {
    sequelize,
    tableName: 'act_dmn_hi_decision_execution',
    timestamps: false,
    indexes: [
      {
        name: "PRIMARY",
        unique: true,
        using: "BTREE",
        fields: [
          { name: "ID_" },
        ]
      },
    ]
  });
};
